home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / gle / util / surf / turboscr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-29  |  2.7 KB  |  158 lines

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <assert.h>
  6. #include <conio.h>
  7. #include <bios.h>
  8. #include <signal.h>
  9. #include <float.h>
  10.  
  11. #define false 0
  12. #define true (!false)
  13.  
  14. #define BCOLOR BLUE
  15. #define FCOLOR MAGENTA
  16. #define HBCOLOR h_bcolor
  17. #define HVCOLOR h_fcolor
  18. #define VCOLOR WHITE
  19.  
  20. extern int h_bcolor;
  21. extern int h_fcolor;
  22.  
  23. int gle_abort(char *s);
  24. int graphmode(void);
  25. int hpgl_initstr(void);
  26.  
  27. scr_refresh()
  28. {
  29. }
  30. int scr_getch()
  31. {
  32.     return getch();
  33. }
  34. void exitcode(int i,int j);
  35. void exitcodef(int i,int j);
  36. scr_init()
  37. {
  38.     signal(SIGFPE,exitcodef);
  39.  
  40.     signal(SIGABRT,exitcode);
  41.     signal(SIGILL,exitcode);
  42.     signal(SIGINT,exitcode);
  43.     signal(SIGSEGV,exitcode);
  44.     signal(SIGTERM,exitcode);
  45. }
  46. int d_tidyup(void);
  47. void exitcode(int i, int j)
  48. {
  49.     static char etxt[60];
  50.     d_tidyup();
  51.     sprintf(etxt,"Exit handler called %d %d \n",i,j);
  52.     gle_abort(etxt);
  53. }
  54. void exitcodef(int i, int j)
  55. {
  56.     d_tidyup();
  57.     printf("Floating point error %d %d \n",i,j);
  58.     if (j==FPE_ZERODIVIDE) gle_abort("Divide by zero \n");
  59.     if (j==FPE_INTDIV0) gle_abort("Interger Divide by zero \n");
  60.     if (j==FPE_OVERFLOW) gle_abort("Numeric overflow \n");
  61.     gle_abort("Floating point Exit handler called");
  62. }
  63. scr_end()
  64. {
  65. }
  66. struct text_info r;
  67. void *screensave;
  68. screen_save()
  69. {
  70.     gettextinfo(&r);
  71.     screensave = malloc(25*80*2);
  72.     if (screensave==NULL) return;
  73.     gettext(1,1,80,25,screensave);
  74. }
  75. screen_restore()
  76. {
  77.     if (screensave==NULL) return;
  78.     puttext(1,1,80,25,screensave);
  79.     free(screensave);
  80.     screensave = NULL;
  81.     textattr(r.attribute);
  82.     window(r.winleft,r.wintop,r.winright,r.winbottom);
  83.     gotoxy(r.curx,r.cury);
  84. }
  85. scr_savexy()
  86. {
  87.     gettextinfo(&r);
  88. }
  89. scr_left(int i)
  90. {
  91.     gotoxy(wherex()-i,wherey());
  92. }
  93. scr_right(int i)
  94. {
  95.     gotoxy(wherex()+i,wherey());
  96. }
  97. scr_restorexy()
  98. {
  99.     textattr(r.attribute);
  100.     window(r.winleft,r.wintop,r.winright,r.winbottom);
  101.     gotoxy(r.curx,r.cury);
  102. }
  103. scr_gets(char *x)
  104. {
  105.     gets(x);
  106. }
  107.  
  108. extern int scr_blackwhite;
  109. scr_norm()  /* yellow on blue */
  110. {
  111.     if (scr_blackwhite) {
  112.         textcolor(WHITE); textbackground(BLACK);
  113.     } else {
  114.         textcolor(YELLOW); textbackground(BLUE);
  115.     }
  116. }
  117. int scr_grey(void);
  118. scr_menuhi()
  119. {
  120.     scr_grey();
  121. }
  122. scr_menuval()
  123. {
  124.     textcolor(WHITE); textbackground(BLUE);
  125. }
  126. scr_menubg()
  127. {
  128.     textcolor(YELLOW); textbackground(BLUE);
  129. }
  130. scr_inv()   /* black on white */
  131. {
  132.     textcolor(WHITE); textbackground(BLACK);
  133. }
  134. scr_grey()  /* black on grey */
  135. {
  136.     textcolor(BLACK); textbackground(LIGHTGRAY);
  137. }
  138. scr_isblackwhite()
  139. {
  140.     char *s;
  141.     s = getenv("CGLE_BLACKWHITE");
  142.     if (s!=NULL) return true;
  143.     else return false;
  144. }
  145. vax_edt(char *s)
  146. {
  147. }
  148. char *getsymbol(char *s)
  149. {
  150.     static char ss[100];
  151.     ss[0] = 0;
  152.     if ( getenv(s) != NULL) strcpy(ss,getenv(s));
  153.     return ss;
  154. }
  155.  
  156.                                                                                        
  157.  
  158.